
<div class="wcontent">
  <div class="wrap_page_content">
    <div class="right_title">
      <h4>
        <?=PAYMENT;?>
      </h4>
    </div>
    <div class="content">
        <!--đã đăng nhập-->
        <? if(isset($_SESSION['member_login']) && $_SESSION['member_login'] == 1) 
    {?>
    	<div class="left">
    	<div class="_text"> <?=PAYMENT_INFO?> </div>
        <form action="<?php echo $FullUrl; ?>/index.php?do=cart&amp;act=ordersm&amp;lg=<?=$_SESSION['lg']?>" class="FormNhaSanXuat" method="post" name="formcontact" id="formcontact" onsubmit="return Register();">
          <div class="Input">
            <div class="HoTen">
              <label for="name_reg">
                <?=LABEL_NAME?>
              </label> <input name="HoTenInput" id="namex" type="text" class="HoTenInput" value="<?=isset($_SESSION['member_name'])?$_SESSION['member_name']:''?>"  />
            </div>
            <div class="DiaChi">
            <label for="address_reg">
                <?=LABEL_ADDRESS?>
              </label>
              <input name="DiaChiInput" id="diachi" type="text" class="DiaChiInput" value="<?=isset($_SESSION['member_address'])?$_SESSION['member_address']:''?>"  />
            </div>
            <div class="DienThoai">
            <label for="phone_reg">
                <?=LABEL_PHONE?>
              </label>
              <input name="DienThoaiInput" id="dienthoai" type="text" class="DienThoaiInput" value="<?=isset($_SESSION['member_phone'])?$_SESSION['member_phone']:''?>"  />
            </div>
            <div class="Email">
            <label for="email_reg">
                <?=LABEL_EMAIL?>
              </label>
              <input name="EmailInput" id="emailx" type="text" class="EmailInput" value="<?=isset($_SESSION['member_email'])?$_SESSION['member_email']:''?>" />
            </div>
            <div class="CongTy">
            	<label for="name_reg">
                <?=COMPANY?>
              </label>
              <input name="CongTyInput" id="congty" type="text" class="EmailInput" />
            </div>
            <div class="TinNhan">
            <label for="TinNhanInput">
                <?=NOTE?>
              </label>
              <textarea name="TinNhanInput" cols="5" rows="5" id="noidung" class="TinNhanInput" style="font-family:Verdana, Geneva, sans-serif;"></textarea>
            </div>
          </div>
          <div class="FooterForm"> <input type="button" onclick="return Register()" value="<?php echo SEND; ?>" class="button" /> <input type="reset" value="<?php echo RESET; ?>" class="button" /> </div>
        </div>
        <div class="right">
    	<div class="_text"> <?=SHIPPING_INFO?> </div>
          <div class="Input">
            <div class="HoTen">
              <label for="name_reg">
                <?=LABEL_NAME?>
              </label> <input name="receive_HoTenInput" id="receive_namex" type="text" class="HoTenInput" value="<?=isset($_SESSION['member_name'])?$_SESSION['member_name']:''?>"  />
            </div>
            <div class="DiaChi">
            <label for="address_reg">
                <?=LABEL_ADDRESS?>
              </label>
              <input name="receive_DiaChiInput" id="receive_diachi" type="text" class="DiaChiInput" value="<?=isset($_SESSION['member_address'])?$_SESSION['member_address']:''?>"  />
            </div>
            <div class="DienThoai">
            <label for="phone_reg">
                <?=LABEL_PHONE?>
              </label>
              <input name="receive_DienThoaiInput" id="receive_dienthoai" type="text" class="DienThoaiInput" value="<?=isset($_SESSION['member_phone'])?$_SESSION['member_phone']:''?>"  />
            </div>
            <div class="Email">
            <label for="email_reg">
                <?=LABEL_EMAIL?>
              </label>
              <input name="receive_EmailInput" id="receive_emailx" type="text" class="EmailInput" value="<?=isset($_SESSION['member_email'])?$_SESSION['member_email']:''?>" />
            </div>
            <div class="CongTy">
            	<label for="name_reg">
                <?=COMPANY?>
              </label>
              
              <input name="receive_CongTyInput" id="receive_congty" type="text" class="EmailInput" />
            </div>
        </form>
        </div></div>
        <? } ?>
        <!--đã đăng nhập-->
      <!--chưa đăng nhập-->
      <? if(!isset($_SESSION['member_login'])) 
    {?>
    	<div class="left">
        <div class="_text">
          <?= SIGN_IN ?>
        </div>
        <form action="<?php echo $FullUrl ?>/index.php?do=member&amp;act=login&amp;lg=<?=$lg?>&amp;page=checkout" class="FormNhaSanXuat" method="post" name="formcontact" id="formcontact">
          <div class="Input">
            <div class="User">
              <label for="user_login">
                <?= EMAIL ?>
              </label>
              <input name="email" id="email" type="text" class="UserInput" value=""  />
            </div>
            <div class="Pass">
              <label for="pass_login">
                <?= PASSWORD ?>
              </label>
              <input name="password" id="password" type="password" class="PassInput" />
            </div>
            <?
            if(isset($_SESSION['counter_login']))
            {
                if($_SESSION['counter_login'] != NULL && $_SESSION['counter_login'] > 1)
                { ?>
                    <br/>
                    <center><img src="<?php echo $FullUrl; ?>/CaptchaSecurityImages.php?width=100&amp;height=40&amp;characters=6" /></center>
                    <p class="security">
                        <input name="security_code" type="text" id="security_code">
                    </p>   
            <?	}
            }?>
            <div class="FooterForm">
               <input class="button" type="submit" value="<?= SIGN_IN ?>" /> 
              <label for="QuenPass"><a class="forgot_pass" href="<?=$FullUrl. $prefix_url?>forgot-password.html">
                <?= FORGOT_PASS ?>
                </a></label>
            </div>
          </div>
        </form>
        </div>
        <!--chưa đăng nhập-->
      <div class="right">
        <div class="_text"> <?=FIRST_TIME_CUSTOMER?> </div>
        <form action="<?=$FullUrl?>/index.php?do=member&amp;act=regis&amp;lg=<?=$lg?>&amp;page=checkout" class="FormNhaSanXuat" method="post" name="formcontact" id="formcontact"">
          <div class="Input">
            <div class="HoTen">
              <label for="name_reg">
                <?=LABEL_NAME?>
              </label>
              <input name="name_reg" id = "name_reg" type="text" class="HoTenInput" value="<? echo isset($_SESSION['form_name']) ? $_SESSION['form_name'] : ''; unset($_SESSION['form_name']);?>"  />
            </div>
            <div id="password" class="DiaChi">
              <label for="password_reg">
                <?=LABEL_PASSWORD?>
              </label>
              <input name="password_reg" id="password_reg" type="password" class="MatKhauInput" />
            </div>
            <div id="retype_password" class="DienThoai">
              <label for="password2_reg">
                <?=LABEL_PASSWORD_RETYPE?>
              </label>
              <input name="password2_reg" id="password2_reg" type="password" class="NhapLaiMatKhauInput" />
            </div>
            <div class="Email">
              <label for="email_reg">
                <?=LABEL_EMAIL?>
              </label>
              <input name="email_reg" id="email_reg" type="text" class="EmailInput" value="<? echo isset($_SESSION['form_email']) ? $_SESSION['form_email'] : '';?>" />
            </div>
            <div class="Email">
              <label for="email2_reg">
                <?=LABEL_EMAIL_RETYPE?>
              </label>
              <input name="email2_reg" id="email2_reg" type="text" class="RetypeEmailInput" value="<? echo isset($_SESSION['form_email']) ? $_SESSION['form_email'] : ''; unset($_SESSION['form_email']);?>" />
            </div>
            <div class="DiaChi">
              <label for="address_reg">
                <?=LABEL_ADDRESS?>
              </label>
              <input name="address_reg" id = "address_reg" type="text" class="DiaChiInput" value="<? echo isset($_SESSION['form_address']) ? $_SESSION['form_address'] : ''; unset($_SESSION['form_address']);?>"  />
            </div>
            <div class="DienThoai">
              <label for="phone_reg">
                <?=LABEL_PHONE?>
              </label>
              <input name="phone_reg" id="phone_reg" type="text" class="DienThoaiInput" value="<? echo isset($_SESSION['form_phone']) ? $_SESSION['form_phone'] : ''; unset($_SESSION['form_phone']);?>" />
            </div>
            <?php /*?><div class="TinNhan">
              <label for="TinNhanInput">
                <?=NOTE?>
              </label>
              <textarea id="TinNhanInput" name="TinNhanInput" cols="5" rows="5" id="noidung" class="TinNhanInput" style="font-family:Verdana, Geneva, sans-serif;">
              </textarea>
            </div><?php */?>
            <?php /*?><div class="check"><input type="checkbox" value="Tôi muốn đăng ký thành viên" /><span>Tôi muốn đăng ký thành viên</span></div><?php */?>
            <div class="captcha">
              <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=<?=PUBLIC_KEY_GOOGLE?>"></script>
              <noscript>
              <iframe src="http://www.google.com/recaptcha/api/noscript?k=<?=PUBLIC_KEY_GOOGLE?>" height="100" width="100" frameborder="0"></iframe>
              <br/>
              <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
              <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
              </noscript>
            </div>
          </div>
          <div class="FooterForm">
            <input class="button" type="submit" value="<?=BTN_REGISTER_SUBMIT?>" onclick="return CheckAllMemberReg();"/>
            <input class="button" type="reset" value="<?=BTN_REGISTER_RETRY?>"/>
          </div>
        </form>
      </div>
      <? } ?>
      <!--chưa đăng nhập-->
    </div>
    <div class="cart_content">
      <table id="Table_01" width="100%"  border="0" cellpadding="0" cellspacing="0" class="ListCart" align="center">
        <!--DWLayoutTable-->
        <tr>
          <td width="100%" valign="top"><form action="index.php?do=cart&amp;act=update" method="post" name="f" id="f" onsubmit="return CheckForm()">
              <table cellpadding="3" cellspacing="0" border="0" width="100%" align="center" class="menu_cap2" id="cart">
                <tr>
                  <td width="5%" align="center" class="table_title"><?php echo NO; ?></td>
                  <td width="20%" class="table_title" align="left">&nbsp;</td>
                  <td width="20%" class="table_title" align="left"><?php echo NAME_PRODUCT; ?></td>
                  <td width="15%" align="center" class="table_title"><?php echo QUANTITY; ?></td>
                  <td width="15%" align="right" class="table_title"><?php echo PRICE; ?></td>
                  <td width="25%" align="right" class="table_title"><?php echo MONEY; ?></td>
                </tr>
                <tr valign="top">
                  <td colspan="7" align="center" class="text"><hr size="1" style="border-top: 1px solid #F2D8DD;"/></td>
                </tr>
                <tr valign="top">
                  <td colspan="7" align="center" class="text" height="10"></td>
                </tr>
                <?
											$c=0;
											$gids=$_SESSION['gids'];	
											if ($gids){
												for ($j=0; $j<count($gids); $j++) 
												if ($gids[$j]) $c++;
											}
											if (($gids)&&($c>0 )) {
											
												global $db;
												$gids=$_SESSION['gids'];
												
												$counts=$_SESSION['counts'];
												$total=0;
												$sl = 0;
												$k=0;
												print('<input type="hidden" name="SoLuongHang" value="'.count($gids).'" />');
												global $tieptuc;
												for ($i=0; $i<count($gids); $i++)
													{  
														
														if ($gids[$i]!=0) {
															$pId = $gids[$i];
															$pos = strpos($pId, "_img");
															if( $pos> 0 ){
																$pId = substr($pId, 0, $pos);
																$q="select id, name_" . $_SESSION['lg'] . " as name, price, cid, img from products where id=".$pId;
															}
															else{
																$q="select id, name_" . $_SESSION['lg'] . " as name, price, cid, img from products where id=".$pId;
															}
															$r = $db->getRow($q);
														if($i == (count($gids)-1)){
															$tieptuc=$r['cid'];
														}
														$k++;
														$gia = number_format($counts[$i])*$r['price'];
														$total+=$gia;
														$qa = number_format($counts[$i]);
														$sl+=$qa;
											?>
                <tr valign="top">
                  <td colspan="7" align="center" class="text" height="10"></td>
                </tr>
                <tr valign="top">
                  <td align="center" class="title" valign="middle"><?=$k?></td>
                  <td class="title" valign="middle"><? $img = GetImage($r['img']); ?>
                    <img src="<?=$img;?>" width="96" height="96" alt="" /></td>
                  <td class="title" valign="middle"><?=$r['name']?></td>
                  <td align="center" class="title" valign="middle"><?=$counts[$i]?></td>
                  <td align="right" class="title" valign="middle"><?=number_format($r['price'])?>
                    <?=CST_CURRENCY_CODE;?></td>
                  <td align="right" class="title" valign="middle"><strong style="color:#FF0000; font-style:italic;">
                    <?=number_format($gia)?>
                    <?=CST_CURRENCY_CODE;?>
                    </strong></td>
                </tr>
                <? if($i != (count($gids)-1)) { ?>
                <tr valign="top">
                  <td colspan="7" align="center" class="text" height="10"></td>
                </tr>
                <tr valign="top">
                  <td colspan="7" align="center" class="text"><hr size="1" style="border-top: 1px solid #F2D8DD;"/></td>
                </tr>
                <? } } } ?>
                <tr valign="top">
                  <td colspan="7" align="center" class="text" height="10"></td>
                </tr>
                <tr valign="top">
                  <td colspan="7" align="center"><hr size="1" style="border-top: 1px solid #F2D8DD;"/></td>
                </tr>
                <tr>
                  <td colspan="5" class="total_cost" align="right"><?php echo TOTAL; ?>:</td>
                  <td class="center" align="right">&nbsp;&nbsp;<strong style="color:#FF0000">
                    <?=number_format($total)?>
                    <?=CST_CURRENCY_CODE;?>
                    </strong></td>
                </tr>
                <? } ?>
              </table>
            </form></td>
        </tr>
        <tr>
          <td height="23" valign="top">&nbsp;</td>
        </tr>
      </table>
    </div>
  </div>
</div>
